﻿-- Change the AuthorID field type to a GUID and remove the referential integrity.
IF OBJECT_ID('dbo.ServiceManNotes', 'U') IS NOT NULL
BEGIN
	IF OBJECT_ID('FK__ServiceMa__Autho__2A6B46EF', 'F') IS NOT NULL
    BEGIN
		ALTER TABLE ServiceManNotes DROP CONSTRAINT FK__ServiceMa__Autho__2A6B46EF
    END
    ALTER TABLE ServiceManNotes DROP COLUMN AuthorID
    ALTER TABLE ServiceManNotes ADD AuthorID uniqueidentifier NULL
END
 
IF OBJECT_ID('dbo.CaseNotes', 'U') IS NOT NULL
BEGIN
    IF OBJECT_ID('FK__CaseNotes__Autho__2882FE7D', 'F') IS NOT NULL
	BEGIN
		ALTER TABLE CaseNotes DROP CONSTRAINT FK__CaseNotes__Autho__2882FE7D
    END
    ALTER TABLE CaseNotes DROP COLUMN AuthorID
    ALTER TABLE CaseNotes ADD AuthorID uniqueidentifier NULL
END
 
IF OBJECT_ID('dbo.GrantNotes', 'U') IS NOT NULL
BEGIN
    IF OBJECT_ID('FK__GrantNote__Autho__297722B6', 'F') IS NOT NULL
    BEGIN
		ALTER TABLE GrantNotes DROP CONSTRAINT FK__GrantNote__Autho__297722B6
    END
    ALTER TABLE GrantNotes DROP COLUMN AuthorID
    ALTER TABLE GrantNotes ADD AuthorID uniqueidentifier NULL
END
GO
